﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DroidClaim.Web.Service;
using DroidClaim.Web.Models;
namespace DroidClaim.Web.Mapper
{
	public class RejectedHistoryMapper
	{
		public static RejectedHistoryModel DtoToModel(RejectedHistoryDto inputDto) 
		{
			RejectedHistoryModel result = new  RejectedHistoryModel();

									result.Id = inputDto.Id;
											result.Reason = inputDto.Reason;
					 
						if(inputDto.ClaimInfo != null)
                          {
							result.ClaimInfo = inputDto.ClaimInfo.Id;
							result.ClaimInfoCode = inputDto.ClaimInfo.Code;
							result.ClaimInfoName = inputDto.ClaimInfo.Name;
						  }
					 
						if(inputDto.Surveyor != null)
                          {
							result.Surveyor = inputDto.Surveyor.Id;
							result.SurveyorCode = inputDto.Surveyor.Code;
							result.SurveyorName = inputDto.Surveyor.Name;
						  }
											result.Code = inputDto.Code;
											result.Name = inputDto.Name;
							
			return result;
		}

		    	
        public static RejectedHistoryDto ModelToDto(RejectedHistoryModel inputModel)
        { 
		
			RejectedHistoryDto result = new  RejectedHistoryDto
        
			{ 

									Id = inputModel.Id,
							
                
									Reason = inputModel.Reason,
							
                
										 ClaimInfo = new ClaimInfoDto() {Id = inputModel.ClaimInfo },
				   			
                
										 Surveyor = new SurveyorDto() {Id = inputModel.Surveyor },
				   			
                
									Code = inputModel.Code,
							
                
									Name = inputModel.Name,
							
                
				 };
            return result;
        }

	}
}